
function random(length, min, max) {
    let arr = []
    for (let i = 0; i < length; i++) {
        let num = min + Math.floor(Math.random() * (max - min))
        arr.push(num)
    }
    return arr;
}

function getData() {
    return {
        "map": {
            "title": "地区销量趋势",
            "base": 310,
            "unit": "万",
            "data": [{
                "name": "上海",
                "data": random(12, 50, 300)
            }, {
                "name": "北京",
                "data": random(12, 50, 300)
            }, {
                "name": "深圳",
                "data": random(12, 50, 300)
            }, {
                "name": "广州",
                "data": random(12, 50, 300)
            }, {
                "name": "重庆",
                "data": random(12, 50, 300)
            }]
        },
        "seller": {
            "title": "商家销量趋势",
            "base": 120,
            "unit": "万",
            "data": [{
                "name": "商家1",
                "data": random(12, 0, 100)
            }, {
                "name": "商家2",
                "data": random(12, 0, 100)
            }, {
                "name": "商家3",
                "data": random(12, 0, 100)
            }, {
                "name": "商家4",
                "data": random(12, 0, 100)
            }, {
                "name": "商家5",
                "data": random(12, 0, 100)
            }]
        },
        "commodity": {
            "title": "商品销量趋势",
            "base": 50,
            "unit": "万",
            "data": [{
                "name": "女装",
                "data": random(12, 0, 50)
            }, {
                "name": "手机数码",
                "data": random(12, 0, 50)
            }, {
                "name": "男装",
                "data": random(12, 0, 50)
            }, {
                "name": "大家电",
                "data": random(12, 0, 50)
            }, {
                "name": "美妆护肤",
                "data": random(12, 0, 50)
            }]
        },
        "common": {
            "month": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"]
        },
        "type": [{
            "key": "map",
            "text": "地区销量趋势"
        }, {
            "key": "seller",
            "text": "商家销量趋势"
        }, {
            "key": "commodity",
            "text": "商品销量趋势"
        }]
    }
}

module.exports = { getData }